<?php
/**
 * 获取对账单下载链接
 *
 */
include './PayTool.php';
$tool = new PayTool();
$params = initParams($tool);

$result = $tool->getResultWithUrl($tool->req_url, $params);

if($tool->checkResult($result)){
    $object = json_decode($result);
    if ($tool->resultSuccess($object)) {
        echo '<br>验签成功 返回结果 '.$result;
    } else {
        echo 'msg : '.$object->msg;
    }
}else{
    echo '<br>验签失败';
}
function initParams($tool){
    $merchant=$tool->merchantId;
    $sn = $tool->getSN($merchant);

    $params = array();
    $params['merchant'] = $merchant;
    $params['sn'] = $sn;
    $params['accCheckOrderType'] = '100003';
    $params['accountDate'] = '20170321';
    $params['busiType'] = '130001';
    $params['version'] = '2.0'; 


    $sign = $tool->sign($params, $tool->pay_key);
    $params['sign']= $sign;
    return $params;


}
?>